Optimal. Leaf size=172 \[ \frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}-\frac {a^2 (1+2 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 172, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3873, 3857,
2722, 4131} \begin {gather*} -\frac {a^2 (2 n+1) \sin (e+f x) \sec ^{n-1}(e+f x) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right )}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \sin (e+f x) \sec ^n(e+f x) \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right )}{f n \sqrt {\sin ^2(e+f x)}}+\frac {a^2 \sin (e+f x) \sec ^{n+1}(e+f x)}{f (n+1)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2722
Rule 3857
Rule 3873
Rule 4131
Rubi steps
\begin {align*} \int \sec ^n(e+f x) (a+a \sec (e+f x))^2 \, dx &=\left (2 a^2\right ) \int \sec ^{1+n}(e+f x) \, dx+\int \sec ^n(e+f x) \left (a^2+a^2 \sec ^2(e+f x)\right ) \, dx\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}+\frac {\left (a^2 (1+2 n)\right ) \int \sec ^n(e+f x) \, dx}{1+n}+\left (2 a^2 \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-1-n}(e+f x) \, dx\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}+\frac {\left (a^2 (1+2 n) \cos ^n(e+f x) \sec ^n(e+f x)\right ) \int \cos ^{-n}(e+f x) \, dx}{1+n}\\ &=\frac {a^2 \sec ^{1+n}(e+f x) \sin (e+f x)}{f (1+n)}-\frac {a^2 (1+2 n) \, _2F_1\left (\frac {1}{2},\frac {1-n}{2};\frac {3-n}{2};\cos ^2(e+f x)\right ) \sec ^{-1+n}(e+f x) \sin (e+f x)}{f \left (1-n^2\right ) \sqrt {\sin ^2(e+f x)}}+\frac {2 a^2 \, _2F_1\left (\frac {1}{2},-\frac {n}{2};\frac {2-n}{2};\cos ^2(e+f x)\right ) \sec ^n(e+f x) \sin (e+f x)}{f n \sqrt {\sin ^2(e+f x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.10, size = 222, normalized size = 1.29 \begin {gather*} -\frac {i 2^{-2+n} a^2 \left (\frac {e^{i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^n (1+\cos (e+f x))^2 \left (\frac {4 e^{i (e+f x)} \, _2F_1\left (1,\frac {1-n}{2};\frac {3+n}{2};-e^{2 i (e+f x)}\right )}{1+n}+\frac {\left (1+e^{2 i (e+f x)}\right ) \, _2F_1\left (1,1-\frac {n}{2};\frac {2+n}{2};-e^{2 i (e+f x)}\right )}{n}+\frac {4 e^{2 i (e+f x)} \, _2F_1\left (1,-\frac {n}{2};\frac {4+n}{2};-e^{2 i (e+f x)}\right )}{\left (1+e^{2 i (e+f x)}\right ) (2+n)}\right ) \sec ^4\left (\frac {1}{2} (e+f x)\right )}{f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.06, size = 0, normalized size = 0.00 \[\int \left (\sec ^{n}\left (f x +e \right )\right ) \left (a +a \sec \left (f x +e \right )\right )^{2}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} a^{2} \left (\int 2 \sec {\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{2}{\left (e + f x \right )} \sec ^{n}{\left (e + f x \right )}\, dx + \int \sec ^{n}{\left (e + f x \right )}\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (a+\frac {a}{\cos \left (e+f\,x\right )}\right )}^2\,{\left (\frac {1}{\cos \left (e+f\,x\right )}\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________